Short video sharing is a very popular function on mobile terminals such as smart phones, tablet computers, and multimedia players at present. A user may record a short video of several seconds and share the short video with a friend by using a smart phone, so that the short video can convey information like a microblog.
A short video sharing application (App) on a mobile terminal using an Android system may call a related function interface built in the system to record a short video. For example, the short video sharing App calls a PreviewCallback interface built in the system, and each time a camera records a frame of preview image, the PreviewCallback interface automatically calls an onPreviewFrame callback function to return current image frame data to the short video sharing App. The short video sharing App buffers each frame of image frame data at a Java layer, and then encodes each frame of image frame data sequentially into a short video.
During the implementation of embodiments of the present disclosure, the inventor finds that the background at least has the following problems: each application, in the Android system, which belongs to the Java layer can only use limited memory of tens of MB, and when the image frame data is buffered at the Java layer, due to a large data amount of the image frame data, a garbage collection (GC) mechanism is frequently triggered when memory is insufficient for the Java layer, and even out of memory (OOM) occurs.